package cz.bernhard.playground.persistance.domain;

/**
 * @author Michal Bernhard (michal.bernhard@cleverlance.com)
 *
 */
public class Book {

	private Integer id;
	private String title;
	private String author;
	private String publisher;
	
	public Integer getId() {
		return id;
	}
	
	public Book setId(Integer id) {
		this.id = id;
		return this;
	}
	
	public String getTitle() {
		return title;
	}
	
	public Book setTitle(String title) {
		this.title = title;
		return this;
	}
	
	public String getAuthor() {
		return author;
	}
	
	public Book setAuthor(String author) {
		this.author = author;
		return this;
	}
	
	public String getPublisher() {
		return publisher;
	}

	public Book setPublisher(String publisher) {
		this.publisher = publisher;
		return this;
	}
	
	@Override
	public String toString() {
		return "Book [id=" + id + ", title=" + title + ", author=" + author
				+ ", publisher=" + publisher + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((author == null) ? 0 : author.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((publisher == null) ? 0 : publisher.hashCode());
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Book other = (Book) obj;
		if (author == null) {
			if (other.author != null)
				return false;
		} else if (!author.equals(other.author))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (publisher == null) {
			if (other.publisher != null)
				return false;
		} else if (!publisher.equals(other.publisher))
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		return true;
	}
	

}
